package com.leap.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import org.springframework.security.core.userdetails.UserDetails;


import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@Builder
@TableName("account")
@Schema(description = "微信小程序用户")
public class Account {
    //雪花算法
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @Schema(description = "用户的openid")
    private String openid;

    @Schema(description = "用户昵称")
    private String name;

    @Schema(description = "用户手机号")
    private String phone;

    @Schema(description = "用户性别")
    private String sex;

    @Schema(description = "用户头像的资源地址")
    private String avatar;

    @TableField(value = "create_time",fill = FieldFill.INSERT )
    private LocalDateTime createTime;

    @Schema(description = "用户邮箱")
    private String email;

    @Schema(description = "用户的生日")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate birth;
}
